﻿using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Scripting.Hosting;
using IronPython.Hosting;
using Microsoft.Scripting.Runtime;
using Wangzeran.CodeMaker.Core.Util;
using System.IO;

namespace CodeMaker.Test
{
    class Program
    {
        private static ScriptEngine engine;

        private static IDictionary<string, string[]> Cache = new Dictionary<string, string[]>();

        static void Main(string[] args)
        {
            try
            {
                engine = Python.CreateEngine();
                ScriptScope scope = engine.CreateScope();

                string[] column = new string[5];
                column[0] = "ID";
                column[1] = "Name";
                column[2] = "Sex";
                column[3] = "Birthday";
                column[4] = "Age";

                engine.SetVariable(scope, "Columns", column);
                ScriptScope resultScope = engine.ExecuteFile("test.py", scope);
                Console.WriteLine(resultScope.GetVariable("Result"));

                Console.WriteLine("执行完毕");

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            finally
            {
                Console.ReadLine();
            }
        }
    }
}
